<html>
<head><meta charset="utf-8"><title>save-analysis based precise analysis · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html">save-analysis based precise analysis</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181122950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181122950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181122950">(Nov 19 2019 at 15:39)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="153740">@Igor Matuszewski</span>, this is the thread to discuss how we add save-analysis to rust-analyzer.I think a reasonable first step is to review analysis-related crates, fix any API issues and publish them to <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a>.</p>
<p>Specifically, I think there might be two things to fix:</p>
<ul>
<li>using <code>anyhow::Errror</code> (or even <code>Box&lt;dyn Send + Sync + 'static&gt;</code>) for error handling. Save-analysis reads data from the OS, so errors are expected, and errors should be helpful.</li>
<li>splitting analysis loading functionality from <code>AnalysisHost</code>. As I understand this, <code>AnalysisHost</code> at the moment contains a Mutext which wraps an analysis insrance and, in general, manages state. I think it's important that we start with the more minimal stateless approach, and add state as an optimization only if we really need it. Or is there already some intermediate crate, which can read analysis from disk, but doesn't use mutexes?</li>
</ul>



<a name="181126391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181126391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181126391">(Nov 19 2019 at 16:07)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> thanks for starting a topic! I was just thinking about it when you posted <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="181126480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181126480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181126480">(Nov 19 2019 at 16:08)</a>:</h4>
<p>Re errors, we definitely should either expand the definition and catch more errors or use the dynamic one, I’m good with either</p>



<a name="181126590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181126590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181126590">(Nov 19 2019 at 16:09)</a>:</h4>
<p>Re mutex, I’d say we should just move it out. It also messes with recursive processing of the data  as well</p>



<a name="181126686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181126686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181126686">(Nov 19 2019 at 16:10)</a>:</h4>
<p>I had a patch somewhere but didn’t go further with that, will need to bring it back</p>



<a name="181126957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181126957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181126957">(Nov 19 2019 at 16:12)</a>:</h4>
<p>Exploring the stateless approach is a good idea, as it strikes a balance between optimizing for subsequent queries and latency stemming from preprocessing the data</p>



<a name="181149993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/181149993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#181149993">(Nov 19 2019 at 20:16)</a>:</h4>
<p>Exploring the stateless approach is a good idea, as it strikes a balance between optimizing for subsequent queries and latency stemming from preprocessing the data</p>



<a name="183592961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183592961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183592961">(Dec 16 2019 at 21:31)</a>:</h4>
<p>So <span class="user-mention" data-user-id="133169">@matklad</span> and <span class="user-mention" data-user-id="153740">@Igor Matuszewski</span> I've been talking to <span class="user-mention" data-user-id="119009">@eddyb</span>. They were making a case for why it makes more sense to use a "LSP server" instead of "command-line tools". The TL;DR, I think, is a few things:</p>
<ul>
<li>stable interface, not something ad-hoc we have to experiment with</li>
<li>ability to stay resident means that repeated uses will be faster</li>
<li>you could still wait to start it (and potentially ask it to quit after some time) to control memory usage</li>
<li>closer to the existing RLS (basically it would be kind of stripped down)</li>
</ul>
<p>I feel like it'd be good maybe to make a hackmd and try to enumerate the arguments in various directions in a bit more depth. I suspect there are a lot of details -- eg., what exactly do we forward? (notably, I would expect we'd not forward details from open files.)</p>



<a name="183631065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183631065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183631065">(Dec 17 2019 at 09:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> , <span class="user-mention" data-user-id="119009">@eddyb</span> hack md sounds nice, I've started one here: <a href="https://hackmd.io/sMospvYyTtisAnLMdlrUgQ" target="_blank" title="https://hackmd.io/sMospvYyTtisAnLMdlrUgQ">https://hackmd.io/sMospvYyTtisAnLMdlrUgQ</a></p>



<a name="183634412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183634412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183634412">(Dec 17 2019 at 10:10)</a>:</h4>
<p>Filled in the document!</p>



<a name="183654107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654107">(Dec 17 2019 at 14:43)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> great! I left a few comments</p>



<a name="183654115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654115">(Dec 17 2019 at 14:43)</a>:</h4>
<p>I had a question though</p>



<a name="183654148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654148">(Dec 17 2019 at 14:43)</a>:</h4>
<p>It seems like there's a "third option" too</p>



<a name="183654249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654249">(Dec 17 2019 at 14:44)</a>:</h4>
<p>Maybe I didn't really understand what you were proposing :)</p>



<a name="183654301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654301">(Dec 17 2019 at 14:45)</a>:</h4>
<p>The third is "CLI tool to replace RLS"?</p>



<a name="183654449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654449">(Dec 17 2019 at 14:46)</a>:</h4>
<p>Yes. I'm not sure it's better than the other two.</p>



<a name="183654455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654455">(Dec 17 2019 at 14:46)</a>:</h4>
<p>Maybe it has the combined downsides of both :)</p>



<a name="183654473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654473">(Dec 17 2019 at 14:46)</a>:</h4>
<p>Yeah, I guess it's a possible extension to the second one</p>



<a name="183654480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654480">(Dec 17 2019 at 14:46)</a>:</h4>
<p>does my description make sense?</p>



<a name="183654509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654509">(Dec 17 2019 at 14:47)</a>:</h4>
<p>yes</p>



<a name="183654532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654532">(Dec 17 2019 at 14:47)</a>:</h4>
<p>I guess the key question is whether rust-analyzer actually has knowledge of save-analysis directly</p>



<a name="183654533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654533">(Dec 17 2019 at 14:47)</a>:</h4>
<p>or not</p>



<a name="183654595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654595">(Dec 17 2019 at 14:48)</a>:</h4>
<p>that's the <em>main</em> difference between the two CLI options, I think</p>



<a name="183654633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654633">(Dec 17 2019 at 14:48)</a>:</h4>
<p>Hm, I think if you actually distribute CLI tools, you have to make them stable for real</p>



<a name="183654659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654659">(Dec 17 2019 at 14:48)</a>:</h4>
<p>while using save-analyzis internall can be sort-of an impl detail</p>



<a name="183654679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654679">(Dec 17 2019 at 14:49)</a>:</h4>
<p>Stability guarantees seems like a bigger difference here</p>



<a name="183654709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654709">(Dec 17 2019 at 14:49)</a>:</h4>
<p>yeah that was first in my list of drawbacks</p>



<a name="183654730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654730">(Dec 17 2019 at 14:49)</a>:</h4>
<p>I'm not sure I agree that we have to support it, but it's a risk for sure</p>



<a name="183654816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654816">(Dec 17 2019 at 14:50)</a>:</h4>
<p>what do you think about distributing rust-analyzer with rustc as the "RLS component"? I guess I kind of think we would want to do that <em>anyway</em></p>



<a name="183654823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654823">(Dec 17 2019 at 14:50)</a>:</h4>
<p>Oh, if we can publish a tool and then just remove it from distribution that would probably be the sweet spot!n</p>



<a name="183654867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654867">(Dec 17 2019 at 14:50)</a>:</h4>
<p>Like, rust-analyzer wouldn't have to know about save-analysis, the tool can, in the future, use rustc API directly, etc etc.</p>
<p>I love it!</p>



<a name="183654899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654899">(Dec 17 2019 at 14:51)</a>:</h4>
<p>in the limit this could be like <code>rustc -Zsomething</code></p>



<a name="183654910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654910">(Dec 17 2019 at 14:51)</a>:</h4>
<p>The hard question here is who will be responsible for merging analysis of several crates into a single analysis of a workspace</p>



<a name="183654925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654925">(Dec 17 2019 at 14:51)</a>:</h4>
<p>but I think that will be hard to figure out because of workspaces</p>



<a name="183654935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183654935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183654935">(Dec 17 2019 at 14:51)</a>:</h4>
<p>I guess that's what you just said</p>



<a name="183655012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655012">(Dec 17 2019 at 14:52)</a>:</h4>
<p>Yeah. At the moment, rls library which loads save analysis is responsible for merging sa from several crates</p>



<a name="183655051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655051">(Dec 17 2019 at 14:52)</a>:</h4>
<p>it would be hard to put that logic directly into rustc, b/c it sort-of depends on Cargo as well</p>



<a name="183655059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655059">(Dec 17 2019 at 14:52)</a>:</h4>
<p>what is the answer to this</p>



<a name="183655066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655066">(Dec 17 2019 at 14:52)</a>:</h4>
<blockquote>
<p>nikomatsakis: The LSP server itself can't require the client to save all modified documents, right? So this would require all editor plugins to be aware of these changes?</p>
</blockquote>



<a name="183655072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655072">(Dec 17 2019 at 14:52)</a>:</h4>
<p>referring to forcing things to save to disk</p>



<a name="183655079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655079">(Dec 17 2019 at 14:52)</a>:</h4>
<p>I think that's a pretty significant drawback worth highlighting :)</p>



<a name="183655247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655247">(Dec 17 2019 at 14:54)</a>:</h4>
<blockquote>
<p>The hard question here is who will be responsible for merging analysis of several crates into a single analysis of a workspace</p>
</blockquote>
<p>I guess I feel like the goal should just be to complete rust-analyzer and remove the save-analysis dependency <em>that</em> way</p>



<a name="183655250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655250">(Dec 17 2019 at 14:54)</a>:</h4>
<p>Yeah, that's true</p>



<a name="183655263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655263">(Dec 17 2019 at 14:54)</a>:</h4>
<p>there should be custom per-client work for this</p>



<a name="183655331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655331">(Dec 17 2019 at 14:55)</a>:</h4>
<p>(though, we already ship custom clients for emacs and VS Code, and some folks ship custom clients for Vims, so I don't see this as a super-major issue)</p>



<a name="183655348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655348">(Dec 17 2019 at 14:55)</a>:</h4>
<p>how hard to do you think it would be to spin up the RLS and forward requests for these specific commands back and forth?</p>



<a name="183655352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655352">(Dec 17 2019 at 14:55)</a>:</h4>
<p>it doesn't, conceptually, seem very hard</p>



<a name="183655365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655365">(Dec 17 2019 at 14:55)</a>:</h4>
<p>(and, like, we don't save docs for <code>cargo watch</code> at all at the moment, and it somehow works ok )</p>



<a name="183655439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655439">(Dec 17 2019 at 14:56)</a>:</h4>
<p>medium annoying I'd say</p>



<a name="183655487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655487">(Dec 17 2019 at 14:56)</a>:</h4>
<p>like you'll need to deal with all kinds of io-related errors and state synchronization between the two processes, but that's not a super big deal</p>



<a name="183655490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655490">(Dec 17 2019 at 14:57)</a>:</h4>
<p>(there are also the drawbacks of the existing RLS design, where it doesn't play as well with custom build environments and so forth)</p>



<a name="183655514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655514">(Dec 17 2019 at 14:57)</a>:</h4>
<p>it definitelly would be a minor issue in comparison to keeping RLS itself building and working</p>



<a name="183655562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655562">(Dec 17 2019 at 14:57)</a>:</h4>
<p>(I'll need to run soon<br>
btw)</p>



<a name="183655565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655565">(Dec 17 2019 at 14:57)</a>:</h4>
<p>you could of course imagine simplifying the RLS to "just" run cargo to get its results -- ah, but I guess that would have the same limitations regarding the VFS</p>



<a name="183655628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655628">(Dec 17 2019 at 14:58)</a>:</h4>
<blockquote>
<p>it definitelly would be a minor issue in comparison to keeping RLS itself building and working</p>
</blockquote>
<p>well, I'm not sure about this</p>



<a name="183655636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655636">(Dec 17 2019 at 14:58)</a>:</h4>
<p>that is</p>



<a name="183655649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655649">(Dec 17 2019 at 14:58)</a>:</h4>
<p>I think that <span class="user-mention" data-user-id="153740">@Igor Matuszewski</span> can speak more to it, but a lot of that work is basically maintaining <em>save analysis</em></p>



<a name="183655663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655663">(Dec 17 2019 at 14:58)</a>:</h4>
<p>at least that's what I remember</p>



<a name="183655674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183655674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183655674">(Dec 17 2019 at 14:58)</a>:</h4>
<p>which seems like it'll be required either way</p>



<a name="183656018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183656018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183656018">(Dec 17 2019 at 15:01)</a>:</h4>
<p>Hm, maybee. But, there's still this whole separate RLS build, submodule and toolstate</p>



<a name="183656083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183656083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183656083">(Dec 17 2019 at 15:02)</a>:</h4>
<p>although, if we really strip RLS down, we might just move it into rustc repo, which simplifies that a lot!</p>



<a name="183658477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/save-analysis%20based%20precise%20analysis/near/183658477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/save-analysis.20based.20precise.20analysis.html#183658477">(Dec 17 2019 at 15:27)</a>:</h4>
<p>Yes, plausibly</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>